#include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){
    int n=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(isdigit(ch)){
        n=n*10+ch-'0';
        ch=getchar();
    }
    return n*f;
}
int n;
int a[100005];
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++)a[i]=read();
    sort(a+1,a+n+1);
    multiset<int> al,h;
    for(int i=1;i<=n;i++)al.insert(a[i]),h.insert(a[i]);
    while(!al.empty()&&!h.empty()){
        int p=*(--al.end());
        if(p<=*h.begin())break;
        int v=*al.upper_bound(*h.begin());
        //cout<<p<<" "<<v<<" "<<*h.begin()<<"\n";
        al.erase(al.find(v));
        if(al.find(*h.begin())!=al.end())al.erase(al.find(*h.begin()));
        h.erase(h.begin());
    }
    cout<<(int)h.size()<<"\n";
    return 0;
}
//Give each of the one million monkeys a keyboard
//and one of them will write a Java program.
//The rest of them will write Perl programs.
